#ifndef VIEWCONTAINERWIDGET_H
#define VIEWCONTAINERWIDGET_H

#include <QWidget>
#include "modalityproperty.h"
class QGridLayout;
class DicomImageView;
class SeriesInstance;

class ViewContainerWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ViewContainerWidget(QWidget *parent = 0);
    ~ViewContainerWidget();

    QList<DicomImageView*> getViewList() const { return viewList; }
    DicomImageView *getCurrentView() const { return curView; }

    void setEventFilter(QObject *filterObj) { installEventFilter(filterObj); filter = filterObj; }

signals:
    void curViewChanged(SeriesInstance *image);

public slots:
    void onSeriesInserted(SeriesInstance *series);
    void onSeriesRemove(SeriesInstance *series);
    void onImageDClicked(SeriesInstance *series);
    void onImageChanged(SeriesInstance *series);
    void onViewImageChanged();
    
    void onViewClicked(DicomImageView *view);
    void onViewDClicked(DicomImageView *view);

    void setViewLayout(int col, int row);
    
    void setPrintMode(bool yes);
    void clear();
    
    // VIEW SLOTS
    void exportImages();
    void copyToClipboard();
    void showAnnotations(bool yes);
    void showMeasurements(bool yes);
    void showCrossRefLine(bool yes);
    void showDicomTags();
    void adjustWL();
    void setDefaultWL();
    void setFullDynamic();
    void invert();
    void setFillViewport();
    void setZoom100();
    void setZoom200();
    void setZoom400();
    void setZoomin();
    void setZoomout();
    void magnifier();
    void zoomImage();
    void panImage();
    void resetPan();
    void slicing();
    void rotateCCW();
    void rotateCW();
    void clearRotate();
    void hFlip();
    void vFlip();
    void clearFlip();
    void drawLength();
    void drawAngle();
    void drawCobbAngle();
    void drawEllipse();
    void drawRectangle();
    void drawPencil();
    void drawText();
    void drawArrow();
    void rmAllMeasurements();
    void incAnnoFont();
    void decAnnoFont();
    void setAnnoFont();
    void reset();

    void prevView();
    void nextView();
    void nextFrame();
    void prevFrame();

protected:
    void resizeEvent(QResizeEvent *e);
    //void keyPressEvent(QKeyEvent *e);

private:
    DicomImageView *createImageView();
    void adjustViewArea();
    
    QFont annoFont;
    QGridLayout *layout;
    QList<DicomImageView*> viewList;
    DicomImageView *curView;
    bool maxed;
    ModalityProperty prop;
    QObject *filter;
};

#endif // VIEWCONTAINERWIDGET_H
